using System;
using Castle.ActiveRecord;
using CosyTrade.Data;
using CosyTrade.Organization;

namespace CosyTrade.Financial
{
    [AddPropertyChangedNotifyInterface, PropertyChangedNotify]
    [ActiveRecord("tabExchangeRate"), Serializable]
    public class ExchangeRate : BusinessObject
    {
        private readonly Guid primaryKey = Guid.NewGuid();
        private int exchangeIndex;
        private DateTime setDate = DateTime.Now;
        private double exchange;
        private Company company;
        private string memo;
        private bool currentRate;

        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access = PropertyAccess.NosetterCamelcase)]
        public override Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        [Property]
        public int ExchangeIndex
        {
            get { return exchangeIndex; }
            set { exchangeIndex = value; }
        }

        [Property]
        public DateTime SetDate
        {
            get { return setDate; }
            set { setDate = value; }
        }

        [Property]
        public double Exchange
        {
            get { return exchange; }
            set { exchange = value; }
        }

        [BelongsTo("CompanyGuid")]
        public Company Company
        {
            get { return company; }
            set { company = value; }
        }

        [Property]
        public string Memo
        {
            get { return memo; }
            set { memo = value; }
        }

        [Property]
        public bool CurrentRate
        {
            get { return currentRate; }
            set { currentRate = value; }
        }
    }
}